package cc.vv.btpartyjob.partymanager.delegate

import android.widget.TextView
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.btpartyjob.partymanager.R
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 添加承诺托管类
 * Created by Chen.qi on 2018/10/24.
 */
class AddPromiseActivityDelegate : BaseAppDelegate() {


    override fun initWidget() {

    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_add_promise
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_appAdd_topBar)
        titleBar?.setTitle(topBarTitle)
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_appAdd_topBar)
        titleBar?.setEventInterface(event)
    }

    /**
     * 获取姓名
     */
    fun setName(name: String) {
        val pa = getView<TextView>(R.id.tv_addAdd_type)
        pa?.text = "驻区党员承诺"
        val patN = getView<TextView>(R.id.tv_addAdd_party)
        patN?.text = "姓名"
        val tvName = getView<TextView>(R.id.tv_appAdd_userName)
        tvName?.text = name
    }


    /**
     * 设置单位名称
     */
    fun setUnitName(unitName: String?) {
        val pa = getView<TextView>(R.id.tv_addAdd_type)
        pa?.text = "驻区单位承诺"
        val patN = getView<TextView>(R.id.tv_addAdd_party)
        patN?.text = "单位"
        val tvName = getView<TextView>(R.id.tv_appAdd_userName)
        tvName?.text = unitName
    }

    /**
     * 获取单位名称
     */
    fun getUnitName(): String {
        val tvUnitName = getView<TextView>(R.id.et_appAdd_unitName)
        return tvUnitName?.text.toString().trim()
    }

    /**
     * 获取单位名称
     */
    fun getCommitedContent(): String {
        val tvContent = getView<TextView>(R.id.et_appAdd_content)
        return tvContent?.text.toString().trim()
    }

    /**
     * 负责人电话
     */
    fun getTelPhone(): String {
        val telPhone = getView<TextView>(R.id.et_appAdd_contactTelPhone)
        return telPhone?.text.toString().trim()
    }


    /**
     * 获得特长
     */
    fun getPersonTeChang(): String {
        val tvTeChang = getView<TextView>(R.id.et_appAdd_personalSpecialty)
        return tvTeChang?.text.toString().trim()
    }


    /**
     * 设置时间
     */
    fun setTime(time: String?) {
        val tvTime = getView<TextView>(R.id.tv_appAdd_chooseCompleteTime)
        tvTime?.text = time
    }

}